package com.hk.springsecurity02.filter;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.filter.OncePerRequestFilter;

import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author by 何坤
 * @Classname MyTestFilter
 * @Description TODO
 * @Date 2019/12/23 8:57
 */
public class MyTestFilter extends OncePerRequestFilter {
    private Logger logger = LoggerFactory.getLogger(OncePerRequestFilter.class);
    @Override
    protected void doFilterInternal(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, FilterChain filterChain) throws ServletException, IOException {
        logger.info("------------------ My Test Filter Begin --------------");
        String username = httpServletRequest.getParameter("username");
        String password = httpServletRequest.getParameter("password");
        filterChain.doFilter(httpServletRequest, httpServletResponse);
        logger.info("------------------ My Test Filter End ---------------");
    }
}
